﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using APIBetaSeries.Models;
using APIBetaSeries.Models.Status;
using APIBetaSeries.Tools;

namespace APIBetaSeries.Managers
{
    public class StatusManager
    {
        private static volatile StatusManager _instance;
        private static Object _syncRoot = new Object();

        private StatusManager()
        {
        }

        public static StatusManager Instance
        {
            get
            {
                if (_instance == null)
                {
                    lock (_syncRoot)
                    {
                        if (_instance == null)
                            _instance = new StatusManager();
                    }
                }
                return _instance;
            }
        }

        public Status GetStatus()
        {
            const string url = "status.xml";
            XDocument xDocument = Requester.Instance.SendMessage(url, null);
            Status response = new Status(xDocument);
            return response;
        }
    }
}
